package com.android.pagemarket.ui.widget;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.android.pagemarket.R;

/*********************************************************
 * @author : zhaohua
 * @version : 2012-11-1
 * @see : 备注弹出框
 * @Copyright : copyrights reserved by personal 2007-2011
 **********************************************************/
public class MarkPopWindow extends PopupWindow
{
    Context mContext;
    private TextView content;
    
    public MarkPopWindow(Context context)
    {
        super(LayoutInflater.from(context).inflate(R.layout.popview_mark, null),
                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        mContext = context;
        setBackgroundDrawable(new ColorDrawable(0x99000000));
        setTouchable(true);
        setFocusable(true);
        setOutsideTouchable(true);
        
        initViews();
    }
    
    private void initViews()
    {
        View v = getContentView();
        v.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                dismiss();
            }
        });
        
        content = (TextView)v.findViewById(R.id.content);
    }
    
    public void setContent(String content)
    {
        if(content == null) return;
        this.content.setText(Html.fromHtml(content));
    }
}
